/*
 * File: current_ctl_loop.h
 *
 * Code generated for Simulink model 'current_ctl_loop'.
 *
 * Model version                  : 3.0
 * Simulink Coder version         : 24.1 (R2024a) 19-Nov-2023
 * C/C++ source code generated on : Mon Jun 16 13:50:09 2025
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: ARM Compatible->ARM Cortex
 * Code generation objectives:
 *    1. Execution efficiency
 *    2. Traceability
 * Validation result: Not run
 */

#ifndef current_ctl_loop_h_
#define current_ctl_loop_h_
#ifndef current_ctl_loop_COMMON_INCLUDES_
#define current_ctl_loop_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif                                 /* current_ctl_loop_COMMON_INCLUDES_ */

#include "current_ctl_pi.h"
#include "deadband_comp.h"

/* Macros for accessing real-time model data structure */
#ifndef rtmCounterLimit
#define rtmCounterLimit(rtm, idx)      ((rtm)->Timing.TaskCounters.cLimit[(idx)])
#endif

#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)
#endif

#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))
#endif

#ifndef rtmGetErrorStatusPointer
#define rtmGetErrorStatusPointer(rtm)  ((const char_T **)(&((rtm)->errorStatus)))
#endif

#ifndef rtmStepTask
#define rtmStepTask(rtm, idx)          ((rtm)->Timing.TaskCounters.TID[(idx)] == 0)
#endif

#ifndef rtmTaskCounter
#define rtmTaskCounter(rtm, idx)       ((rtm)->Timing.TaskCounters.TID[(idx)])
#endif

#define current_ctl_loop_M             (_rt_M)

/* Forward declaration for rtModel */
typedef struct tag_RTM RT_MODEL;

/* Block signals and states (default storage) for system '<Root>' */
typedef struct
{
    current_ctl_pi_MdlrefDW current_loop_ctl_InstanceData;/* '<Root>/current_loop_ctl' */
    deadband_comp_MdlrefDW ua_comp_InstanceData;/* '<Root>/ua_comp' */
    deadband_comp_MdlrefDW ub_comp_InstanceData;/* '<Root>/ub_comp' */
    deadband_comp_MdlrefDW uc_comp_InstanceData;/* '<Root>/uc_comp' */
    real32_T sv_uabc[3];               /* '<Root>/current_loop_ctl' */
    real32_T u_tar_comp;               /* '<Root>/ua_comp' */
    real32_T u_tar_comp_o;             /* '<Root>/ub_comp' */
    real32_T u_tar_comp_n;             /* '<Root>/uc_comp' */
    real32_T n_ang;                    /* '<Root>/mod2pi_fun' */
}
DW;

/* instance parameters, for system '<Root>' */
typedef struct
{
    current_ctl_pi_InstP current_ctl_loop_rt_current_loop_ctl;/* '<Root>/current_loop_ctl' */
}
InstP;

/* External inputs (root inport signals with default storage) */
typedef struct
{
    real32_T idq_tar_A[2];             /* '<Root>/idq_tar_A' */
    real32_T iabc_now_A[3];            /* '<Root>/iabc_now_A' */
    real32_T elec_theta_rad;           /* '<Root>/elec_theta_rad' */
    real32_T i_noise_A;                /* '<Root>/i_noise_A' */
    real32_T comp_du_V;                /* '<Root>/comp_du_V' */
}
ExtU;

/* External outputs (root outports fed by signals with default storage) */
typedef struct
{
    real32_T uabc_tar_comp_V[3];       /* '<Root>/uabc_tar_comp_V' */
    real32_T idq_now_A[2];             /* '<Root>/idq_now_A' */
}
ExtY;

/* Real-time Model Data Structure */
struct tag_RTM
{
    const char_T *errorStatus;

    /*
     * Timing:
     * The following substructure contains information regarding
     * the timing information for the model.
     */
    struct
    {
        struct
        {
            uint32_T TID[2];
            uint32_T cLimit[2];
        }
        TaskCounters;
    }
    Timing;
};

/* Block signals and states (default storage) */
extern DW _rt_DW;

/* instance parameters */
extern InstP _rt_InstP;

/* External inputs (root inport signals with default storage) */
extern ExtU _rt_U;

/* External outputs (root outports fed by signals with default storage) */
extern ExtY _rt_Y;

/* Model entry point functions */
extern void current_ctl_loop_initialize(void);
extern void current_ctl_loop_step0(void);
extern void current_ctl_loop_step1(void);

/* Real-time Model object */
extern RT_MODEL *const _rt_M;

/*-
 * The generated code includes comments that allow you to trace directly
 * back to the appropriate location in the model.  The basic format
 * is <system>/block_name, where system is the system number (uniquely
 * assigned by Simulink) and block_name is the name of the block.
 *
 * Use the MATLAB hilite_system command to trace the generated code back
 * to the model.  For example,
 *
 * hilite_system('<S3>')    - opens system 3
 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
 *
 * Here is the system hierarchy for this model
 *
 * '<Root>' : 'current_ctl_loop'
 * '<S1>'   : 'current_ctl_loop/mod2pi_fun'
 */

/*-
 * Requirements for '<Root>': current_ctl_loop

 */
#endif                                 /* current_ctl_loop_h_ */

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
